package be.kdg.netpresent;

import java.rmi.registry.LocateRegistry;

public class NetPresent {
	
	// Constructor of the class which takes care of the
	// full creation of the RMI service.
	public NetPresent() {
		try {
			// Create RMI Registry "on port 2021"
			LocateRegistry.createRegistry(2021);
			
			// Create the interface/instance of the actual service
			// and its invokable methods. 
			NetPresentInt netpresent = new NetPresentImpl();
			
			// Bind this to the earlier created registry
			LocateRegistry.getRegistry(2021).rebind("/NetPresent", netpresent);
			
			// "Debug" print to message that the service should
			// be up and running at this point.
			System.out.println("NetPresent started");
		} catch (Exception e) {
			System.out.println("Trouble: " + e);
		}
	}

	// Main method which just calls the constructor...
	public static void main(String args[]) {
		new NetPresent();	
	}
}
